package org.jeecg.modules.param.refund.service.impl;


import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.param.refund.entity.BikeMemberUserReturn;
import org.jeecg.modules.param.refund.mapper.BikeMemberUserReturnMapper;
import org.jeecg.modules.param.refund.service.IBikeMemberUserReturnService;
import org.jeecg.modules.utils.CostUtils;
import org.jeecg.modules.utils.ExcelUtils;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Comparator;
import java.util.List;

/**
 * @Description: 退款记录
 * @Author: 月月鸟
 * @Date:   2021-05-31
 * @Version: V1.0
 */
@Service
public class BikeMemberUserReturnServiceImpl extends ServiceImpl<BikeMemberUserReturnMapper, BikeMemberUserReturn> implements IBikeMemberUserReturnService {
    @Resource
    private BikeMemberUserReturnMapper bikeMemberUserReturnMapper;
    @Override
    public Result<?> queryPageList(Integer pageNo, Integer pageSize, BikeMemberUserReturn bikeMemberUserReturn) {

        List<BikeMemberUserReturn> list =  bikeMemberUserReturnMapper.queryPageList(bikeMemberUserReturn);
        for (BikeMemberUserReturn tb : list){
            if (tb.getUseLong()!=null){
                tb.setUseMMss(CostUtils.MMss(tb.getUseLong()));
            }
        }
        return Result.OK(list);
    }

    @Override
    public ModelAndView exportXls(HttpServletRequest request, BikeMemberUserReturn bikeMemberUserReturn, Class<BikeMemberUserReturn> bikeMemberUserReturnClass, String titel) {
        List<BikeMemberUserReturn> list =  bikeMemberUserReturnMapper.queryPageList(bikeMemberUserReturn);
        for (BikeMemberUserReturn tb : list){
            if (tb.getUseLong()!=null){
                tb.setUseMMss(CostUtils.MMss(tb.getUseLong()));
            }
        }
        return ExcelUtils.exportXls(request,list,BikeMemberUserReturn.class,titel);
    }
}
